//
//  RGRecommendVideoModel.m
//  RedGrass
//
//  Created by wukong on 2019/1/10.
//  Copyright © 2019年 hongcaosp. All rights reserved.
//

#import "RGRecommendVideoModel.h"
#import "NSString+Extension.h"
@implementation RGVideoUserInfoModel

+(BOOL)propertyIsOptional:(NSString*)propertyName{
    return YES;
}

//+ (JSONKeyMapper *)keyMapper{
//    // 属性名作为key ,字典中的key名 作为 value
//    return [[JSONKeyMapper alloc]initWithModelToJSONDictionary:@{@"userId":@"id"}];
//}


@end

@implementation RGRecommendVideoModel

+(BOOL)propertyIsOptional:(NSString*)propertyName{
    return YES;
}

+ (JSONKeyMapper *)keyMapper{
    // 属性名作为key ,字典中的key名 作为 value
    return [[JSONKeyMapper alloc]initWithModelToJSONDictionary:@{@"ID":@"id"}];
}

- (NSInteger)height {
    if (!self.videoHeight) {
        return 700;
    }else {
        return self.videoHeight;
    }
}

- (NSInteger)width {
    if (!self.videoWidth) {
        return KScreenWidth-15*2;
    }else {
        return self.videoWidth;
    }
}

- (CGFloat)cellHeight {
    NSInteger videoWidth = _videoWidth;
    NSInteger videoHeight = _videoHeight;
    CGFloat width = kScreenWidth - 100;
    CGFloat newHeight = width * 3/2;
    if (videoWidth > 0 && videoHeight > 0) {
        if (videoHeight * 2 < videoWidth * 3) {
            newHeight = width * videoHeight/videoWidth;
        }
    }
    CGFloat height = newHeight;
//    if (self.width/KScale <= KScreenWidth-15*2) {
//        height = self.height/KScale;
//    }else {
//        height = self.height/KScale * ((KScreenWidth-15*2)/self.width);
//    }
    
    height += [self.videoDesc multiLineSizeWithAttributeText:(KScreenWidth-15*2) font:FONT(customFontNameLight, 15)].height;
    height += 5+39+15+10+10+50+10;
    return height;
}

@end
